/**
 * @author 太阳当空丶赵
 * @date 2023/1/4-17:52
 * @version 1.0.0
 * applet
 */
import {get, post, uploadFileRequest} from "@/utils/requests/requests"

/**
 * 管理员获取广告列表 ---- 分页
 * */
export function getBannerList(pageNo, pageSize) {
    return post({
        url: '/admin/advertisement/getAdvertisementsByPage',
        params: {
            pageNo,
            pageSize
        }
    })
}

/**
 * 修改广告状态
 * */
export function changeBannerStatus(id, status) {
    return post({
        url: '/admin/advertisement/modifyAdvertisementStatusById',
        noJson: 1,
        params: {
            id,
            status
        }
    })
}

/**
 * 添加广告
 * */
export function uploadBanner(data) {
    return uploadFileRequest("/admin/advertisement/releaseAdvertisement", data)
}

/**
 * 根据id删除广告
 * */
export function deleteBanner(id) {
    return post({
        url: "/admin/advertisement/delAdvertisementById",
        noJson: 1,
        params: {id}
    })
}
/**
 * 根据id修改广告
 * */
export function changeBanner(id,title,file){
    const formData = new FormData()
    formData.append("id",id)
    formData.append("title",title)
    formData.append("file",file)
    return uploadFileRequest("/admin/advertisement/modifyAdvertisementById", formData)
}

